import axios from 'axios'
export const getlogin = async (params) => {
  return axios({
    url: 'http://localhost:3000/user2',
    params
  })
}
export const getReigist = async (username) => {
  return axios({
    url: 'http://localhost:3000/user2',
    params: { username }
  })
}
export const Reigist = async (data) => {
   try{
     await axios({
      method: 'POST',
      url: 'http://localhost:3000/user2',
      data:{
        ...data,
        caeate:new Date(),
        img:'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=249589786,2941481629&fm=26&gp=0.jpg',
        info:'还未填写个人介绍'
      }
    })
    return {code:200}
   }catch{
    return false
   }
}
// 上传图片
export const changeImg = async (img,config) => {
  return await axios({
    url: 'http://182.92.156.134:8080/upload',
    method:'post',
    data: img,
    config
  })
}
// 修改个人信息
export const changeuser = async (data,id) => {
  return await axios({
    url: 'http://localhost:3000/user2/'+id,
    method:'patch',
    data
  })
}